﻿@using ECG.Utility
@using ECG.WebUI.CustomHelpers
@model List<ECG.Common.ProductRateByCateTopListPagingDto>
<input type="hidden" name="hidDataPagging" class="hidDataPagging" value="" iTotalPage="@ViewBag.TotalPage" iCate="@ViewBag.Category" iCurrentPage="@ViewBag.CurrentPage"/>
@if (Model.Any())
{
    foreach (var item in Model)
    {
        var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });
    <li>
        <div class="pItem">
            @if (item.CreateDate.Day <= DateTime.Now.Day && item.CreateDate.Day > DateTime.Now.Day -5)
            {
                <i class="icon-cate-new">MỚI</i>
            }
            <a href="@pDetailLink" class="pItem-lnkImg">
                @if (item.DiscountPercentage > 0)
                {
                    <span class="pItem-per">-@item.DiscountPercentage.ToString("#.#")<i>%</i></span>
                }
                <img src="@item.ImagePath.ImagePathThumb(135, 135)" width="135" height="135" alt="@item.Name" class="lzLoading" />
            </a>
            <div class="pItem-info">
                <h2>
                    <a href="@pDetailLink">@item.Name</a>
                </h2>
                @if (item.PromotionPrice > 0)
                {
                    <p class="pItem-PriceOld">
                        @item.Price.ToString("##,###,###") đ
                    </p>
                    <p class="pItem-PriceNew">
                        @item.PromotionPrice.ToString("##,###,###") <strong>đ</strong>
                    </p>
                }
                else
                {
                    <p class="pItem-PriceNew">
                        @item.Price.ToString("##,###,###") <strong>đ</strong>
                    </p>
                }
            </div>
        </div>
    </li>
    }
}
